package com.healthcare.apm.category.tool;

import com.healthcare.apm.category.model.DataTypeConfig;

import javax.sql.DataSource;

public class CategoryToolFactory {


    private  DataSource memoryDataSource;

    private  DataSource fileDataSource;

    public CategoryToolFactory(DataSource memoryDataSource, DataSource fileDataSource) {
        this.memoryDataSource = memoryDataSource;
        this.fileDataSource = fileDataSource;
    }

    public CategoryTraining buildBayesianCategoryTraining(DataTypeConfig config) {
        BayesianCategoryTrainer trainer = new BayesianCategoryTrainer();
        JDBCCategoryTools tools = new JDBCCategoryTools(fileDataSource);
        trainer.setJdbcCategoryTools(tools);
        trainer.setDataTypeConfig(config);
        trainer.init();
        return trainer;
    }
}
